export const schema = {
    type: "page",
    title: "权限设置",
    toolbar: {
        type: "button",
        actionType: "submit",
        label: "保存",
        icon: "fa fa-save pull-left",
        level: "primary",
        target: "theform"
    },
    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "查看",
                    to: "/team/view/${id}"
                },
                {
                    label: "编辑",
                    to: "/team/edit/${id}",
                    // acl: "team:edit",
                    visibleOn: 'acl.can("team:edit")',
                },
                {
                    label: "权限配置",
                    to: "/team/acl/${id}",
                    visibleOn: 'acl.can("team:setting")',
                    // acl: "team:setting"
                }
            ]
        },
        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                className: "m-t-md",
                panelClassName: "no-border no-shadow",
                api: "post:/api/team/acl/${id}",
                initApi: "/api/team/acl/${id}",
                submitText: "",
                name: "theform",
                type: "form",
                title: "",
                mode: "horizontal",
                disabledOn: 'data.canEdit == 0',
                controls: [
                    {
                        type: "checkboxes",
                        name: "acl",
                        label: "权限配置",
                        value: "owner-subteam",
                        visibleOn: 'acl.can("project:verify")&&acl.can("score_mall:merchant")',
                        options: [
                            {
                                label: "发布商品",
                                value: "auth-create-goods",
                            },
                            {
                                label: "项目免审权",
                                value: "project-skip-verify"
                            },
                            {
                                label: "拥有子团队权",
                                value: "owner-subteam"
                            }
                        ]
                    },
                    // 团队不能修改子团队的发布商品的权限
                    {
                        type: "checkboxes",
                        name: "acl",
                        label: "权限配置",
                        value: "owner-subteam",
                        visibleOn: 'acl.can("project:verify")&&!acl.can("score_mall:merchant")',
                        options: [
                            {
                                label: "项目免审权",
                                value: "project-skip-verify"
                            },
                            {
                                label: "拥有子团队权",
                                value: "owner-subteam"
                            }
                        ]
                    },

                    {
                        type: "checkboxes",
                        name: "acl",
                        label: "权限配置",
                        value: "owner-subteam",
                        visibleOn: '!acl.can("project:verify")',
                        options: [
                            {
                                label: "项目免审权",
                                value: "project-skip-verify",
                                disabled: true
                            },
                            {
                                label: "拥有子团队权",
                                value: "owner-subteam"
                            }
                        ]
                    },

                    {
                        type: "divider"
                    },

                    {
                        type: "radios",
                        name: "join_type",
                        label: "加入权限配置",
                        value: "2",
                        options: [
                            {
                                label: "免审加入",
                                value: "1"
                            },
                            {
                                label: "需要审核加入",
                                value: "2"
                            },
                            {
                                label: "不允许任何人加入",
                                disabled: true,
                                value: "3"
                            }
                        ]
                    }
                ]
            }
        }
    ]
};
